<html>
<head><meta charset="utf-8"><title>unstable completion items · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/unstable.20completion.20items.html">unstable completion items</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="179722335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/unstable%20completion%20items/near/179722335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Martin Asquino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/unstable.20completion.20items.html#179722335">(Nov 02 2019 at 22:50)</a>:</h4>
<p>Hi! I was looking at this issue <a href="https://github.com/rust-analyzer/rust-analyzer/issues/2003" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/2003">https://github.com/rust-analyzer/rust-analyzer/issues/2003</a> and was trying to figure out what it would take to fix it. I managed to keep the unstable macros out of the completion items list by checking whether they include the unstable attribute, but I have a couple of doubts.</p>
<p>- Should this be fixed only for macros? Or all kinds of completion items?<br>
- I have mixed feelings about modifying <code>Completions::add_macro</code> to check if the node has an <code>unstable</code> attribute, mainly because the name of the function, <code>add_macro</code> sounds like it should definitely add a macro  completion item to the list. But doing that check before the call to <code>add_macro</code> means having duplicated code. Am I being to pedantic and should just add that check there?</p>



<a name="179727445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/unstable%20completion%20items/near/179727445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/unstable.20completion.20items.html#179727445">(Nov 03 2019 at 01:56)</a>:</h4>
<p>If I understand correctly, we could handle the <code>unstable</code> attribute similar to <a href="https://github.com/rust-analyzer/rust-analyzer/search?q=is_cfg_enabled&amp;unscoped_q=is_cfg_enabled" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/search?q=is_cfg_enabled&amp;unscoped_q=is_cfg_enabled"><code>cfg</code></a>.  If we don't collect them, it will not show in completion items.</p>



<a name="179736361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/unstable%20completion%20items/near/179736361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/unstable.20completion.20items.html#179736361">(Nov 03 2019 at 07:16)</a>:</h4>
<p>But we do want to show unstable items like <code>Vec::partition_at_index</code>, at least for nightly users</p>



<a name="179736411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/unstable%20completion%20items/near/179736411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/unstable.20completion.20items.html#179736411">(Nov 03 2019 at 07:18)</a>:</h4>
<p>One heuristic could be to look for the issue number (<code>format_args_nl</code> has 0)</p>



<a name="179739993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/unstable%20completion%20items/near/179739993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/unstable.20completion.20items.html#179739993">(Nov 03 2019 at 09:25)</a>:</h4>
<p>there are two separate issues here I think:</p>
<ul>
<li>hiding unstable things from completion (which is relevant not only for macros)</li>
<li>hide imp-detail macros, which are public only for macro scoping reasons</li>
</ul>
<p>I wonder if the best way to tackle 2 is to look for <code>#[doc(hidden)]</code> attribute?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>